<div class="comments-byuser rightBox">
    <h3>Последние коментарии</h3>
    <ul class="comments">
        <? foreach ($rows as $id => $row) { ?>
            <?= $row; ?>
        <? } ?>
    </ul>
</div>
<script>
(function ($) {
    $(document).ready(function () {
        var $this = $('.comments-byuser.rightBox');
        $this.siblings('.leftBox').length || $this.removeClass('rightBox').addClass('leftBox');
    });
})(jQuery);
</script>